import com.api.POIWrite;
import com.mapper.sql.poiMapper_sql;
import com.mapper.sqlite.poiMapper_sqlite;
import com.util.MapperUtil;
import org.apache.ibatis.session.SqlSession;

public class App {
    //这里为启动类，在这里调用都需要进行静态修饰
    private static SqlSession sqlSession_sql;
    private static SqlSession sqlSession_sqlite;
    //获取mapper实现
    private static poiMapper_sql mapper_sql;
    private static poiMapper_sqlite mapper_sqlite;

    //获取poi写入excel的具体实现方法
    private static POIWrite poiWrite;

    //判断Session是否为空，为空关闭
    private static void colse(){
        if(sqlSession_sql!=null){
            sqlSession_sql.close();
        }
        if(sqlSession_sqlite!=null){
            sqlSession_sqlite.close();
        }
    }






    public static void main(String[] args) throws Exception{
        //sql
        //通过实现的MapperUtil工具开启Session
        sqlSession_sql= MapperUtil.sqlSession_sql.openSession();
        //开启session后获取具体的mapper查询实现文件
        mapper_sql=sqlSession_sql.getMapper(poiMapper_sql.class);

        //sqlite
        sqlSession_sqlite=MapperUtil.sqlSession_sqlite.openSession();
        mapper_sqlite=sqlSession_sqlite.getMapper(poiMapper_sqlite.class);

        //调用poi写入excel方法
        POIWrite.poiListExcel(mapper_sql,mapper_sqlite);



    }
}
